package com.aim.analysis.records;

import java.util.HashMap;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * User: User
 * Date: 6/4/14
 * Time: 9:30 PM
 * To change this template use File | Settings | File Templates.
 */
public enum RecordType {

    gameStarted(0,"game started"),
    meteorSummery(10,"meteorSummery"),
    maintenaneAction(2,"maintenane action"),
    alertBeforeDisplayed(11,"alertBeforeDisplayed"),
    mechanicalConditionChanged(7,"mechanical condition changed"),
    repairAction(1,"repair action"),
    fuelStationCreated(6,"fuel station created"),
    fuelFill(4,"fuel fill"),
    fuelFillBySpaceship(5,"fuel fill by spaceship"),
    gameEnd(99,"game end"),
    ;

    final int code;
    final String description;

    private RecordType(int code, String description) {
        this.code = code;
        this.description = description;
    }


    private static Map<Integer, RecordType> codeMap = new HashMap<Integer, RecordType>();

    static {
        for (RecordType recordType : RecordType.values()) {
            codeMap.put(recordType.code, recordType);
        }
    }

    public static RecordType byCode(int code){
        return codeMap.get(code);
    }
}
